package com.rc.saas.tenant.vo.order;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rc.saas.tenant.common.enums.*;
import com.rc.saas.tenant.model.operator.TenantOperator;
import com.rc.saas.tenant.model.order.OrderInfo;
import com.rc.saas.tenant.model.order.OrderInfoDiscountTypeConverter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author frog
 * @date 2019/11/18
 */
public class OrderResult extends OrderInfo {

    /**
     * 0:自有/外部互联 1:内部互联 2:内部互联第三方
     */
    @ExcelIgnore
    private String orderInfoHlhtType;

    @ExcelProperty(value = "站点名称",index = 5)
    private String stationName;
    @ExcelIgnore
    private String pileSort;
    @ExcelIgnore
    private String pileNo;
    @ExcelProperty(value = "充电枪编号",index = 4)
    private String gunNo;
    @ExcelProperty(value = "用户姓名",index = 7)
    private String nickname;
    @ExcelProperty(value = "手机号",index = 8)
    private String mobile;
    @ExcelIgnore
    private String tenantName;
    @ExcelIgnore
    private String carNumber;
    @ExcelIgnore
    private String chargeType;

    @ExcelIgnore
    private BigDecimal power;
    @ExcelIgnore
    private BigDecimal elecAmount;
    @ExcelIgnore
    private BigDecimal serviceAmount;

    @ExcelIgnore
    private String pileStopReasonVo;

    @ExcelIgnore
    private String lastTime;

    @ExcelIgnore
    private String discountType;

    @ExcelProperty(value = "优惠方式",index = 19,converter = OrderInfoDiscountTypeConverter.class)
    private String discountName;

    //private BigDecimal sharpPower;
    @ExcelIgnore
    private BigDecimal lowPower;
    @ExcelIgnore
    private BigDecimal highPower;
    @ExcelIgnore
    private BigDecimal flatPower;
    //private BigDecimal sharpBaseAmount;
    @ExcelIgnore
    private BigDecimal lowBaseAmount;
    @ExcelIgnore
    private BigDecimal highBaseAmount;
    @ExcelIgnore
    private BigDecimal flatBaseAmount;
    //private BigDecimal sharpServiceAmount;
    @ExcelIgnore
    private BigDecimal lowServiceAmount;
    @ExcelIgnore
    private BigDecimal highServiceAmount;
    @ExcelIgnore
    private BigDecimal flatServiceAmount;

    @ExcelIgnore
    private String hlhtOperator;
    @ExcelIgnore
    private String hlhtOperatorName;

    @ExcelIgnore
    private String elecServerDomain;

    @ExcelIgnore
    private String brandName;

    @ExcelIgnore
    private String hlhtTenantName;

    @ExcelIgnore
    private String companyName;

    @ExcelIgnore
    private String exceptionStartTime;
    @ExcelIgnore
    private String exceptionEndTime;
    @ExcelIgnore
    private String exceptionLastTime;
    @ExcelIgnore
    private Long exceptionOrderInfoId;
    @ExcelIgnore
    private BigDecimal exceptionPower;
    @ExcelIgnore
    private BigDecimal exceptionElecAmount;
    @ExcelIgnore
    private BigDecimal exceptionServiceAmount;
    @ExcelIgnore
    private BigDecimal exceptionTotalMoney;
    @ExcelIgnore
    private BigDecimal exceptionDiscountAmount;
    @ExcelIgnore
    private BigDecimal exceptionPayAmount;
    @ExcelIgnore
    private BigDecimal exceptionBeginSoc;
    @ExcelIgnore
    private BigDecimal exceptionSoc;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date repairTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ExcelProperty(value = "充电日期",index = 3)
    private Date chargeDate;

    @ExcelProperty(value = "充电时长",index = 13)
    //@com.alibaba.excel.annotation.format.DateTimeFormat("HH:mm:ss")
    private String timeStr;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date payTime;

    @ExcelIgnore
    private String exceptionLastUpdatedBy;

    /**异常订单历史数据*/
    @ExcelIgnore
    private String hisStartTime;
    @ExcelIgnore
    private String hisEndTime;
    @ExcelIgnore
    private String hisLastTime;
    @ExcelIgnore
    private BigDecimal hisPower;
    @ExcelIgnore
    private BigDecimal hisElecAmount;
    @ExcelIgnore
    private BigDecimal hisServiceAmount;
    @ExcelIgnore
    private BigDecimal hisTotalMoney;
    @ExcelIgnore
    private BigDecimal hisDiscountAmount;
    @ExcelIgnore
    private BigDecimal hisPayAmount;
    @ExcelIgnore
    private BigDecimal hisBeginSoc;
    @ExcelIgnore
    private BigDecimal hisSoc;

    /**电费差价*/
    @ExcelIgnore
    private BigDecimal diffElecMoney;
    /**服务费差价*/
    @ExcelIgnore
    private BigDecimal diffServiceMoney;
    /**实付差值*/
    @ExcelIgnore
    private BigDecimal diffPayAmount;
    /**解决办法*/
    @ExcelIgnore
    private String solution;
    /**状态*/
    @ExcelIgnore
    private String exceptionStatus;
    /**驳回原因*/
    @ExcelIgnore
    private String rejectionReason;
    /**交易流水号*/
    @ExcelProperty(value = "交易流水号",index = 1)
    private String inTradeNo;


    /**内部互联电量*/
    @ExcelIgnore
    private BigDecimal intranetTotalPower;
    /**内部互联电费*/
    @ExcelIgnore
    private BigDecimal intranetTotalElecMoney;
    /**内部互联服务费*/
    @ExcelIgnore
    private BigDecimal intranetTotalSeviceMoney;
    /**内部互联总价*/
    @ExcelIgnore
    private BigDecimal intranetTotalMoney;
    /**内部互联实付*/
    @ExcelIgnore
    private BigDecimal intranetPayAmount;
    /**内部互联折扣*/
    @ExcelIgnore
    private BigDecimal intranetDiscount;

    @ExcelProperty(value = "充电结束说明",index = 24)
    private String stopMsg;


    public String getInTradeNo() {
        return inTradeNo;
    }

    public void setInTradeNo(String inTradeNo) {
        this.inTradeNo = inTradeNo;
    }

    public String getStopMsg() {
        return stopMsg;
    }

    public void setStopMsg(String stopMsg) {
        this.stopMsg = stopMsg;
    }

    public String getPileSort() {
        return pileSort;
    }

    public void setPileSort(String pileSort) {
        this.pileSort = pileSort;
    }

    public BigDecimal getIntranetTotalPower() {
        return intranetTotalPower;
    }

    public void setIntranetTotalPower(BigDecimal intranetTotalPower) {
        this.intranetTotalPower = intranetTotalPower;
    }

    public BigDecimal getIntranetTotalElecMoney() {
        return intranetTotalElecMoney;
    }

    public void setIntranetTotalElecMoney(BigDecimal intranetTotalElecMoney) {
        this.intranetTotalElecMoney = intranetTotalElecMoney;
    }

    public BigDecimal getIntranetTotalSeviceMoney() {
        return intranetTotalSeviceMoney;
    }

    public void setIntranetTotalSeviceMoney(BigDecimal intranetTotalSeviceMoney) {
        this.intranetTotalSeviceMoney = intranetTotalSeviceMoney;
    }

    public BigDecimal getIntranetTotalMoney() {
        return intranetTotalMoney;
    }

    public void setIntranetTotalMoney(BigDecimal intranetTotalMoney) {
        this.intranetTotalMoney = intranetTotalMoney;
    }

    public BigDecimal getIntranetPayAmount() {
        return intranetPayAmount;
    }

    public void setIntranetPayAmount(BigDecimal intranetPayAmount) {
        this.intranetPayAmount = intranetPayAmount;
    }

    public BigDecimal getIntranetDiscount() {
        return intranetDiscount;
    }

    public void setIntranetDiscount(BigDecimal intranetDiscount) {
        this.intranetDiscount = intranetDiscount;
    }
    @ExcelProperty(value = "所属加盟商",index = 6)
    private String operatorName;

    public BigDecimal getDiffPayAmount() {
        return diffPayAmount;
    }

    public void setDiffPayAmount(BigDecimal diffPayAmount) {
        this.diffPayAmount = diffPayAmount;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public Long getExceptionOrderInfoId() {
        return exceptionOrderInfoId;
    }

    public void setExceptionOrderInfoId(Long exceptionOrderInfoId) {
        this.exceptionOrderInfoId = exceptionOrderInfoId;
    }

    public String getExceptionStartTime() {
        return exceptionStartTime;
    }

    public void setExceptionStartTime(String exceptionStartTime) {
        this.exceptionStartTime = exceptionStartTime;
    }

    public String getExceptionEndTime() {
        return exceptionEndTime;
    }

    public void setExceptionEndTime(String exceptionEndTime) {
        this.exceptionEndTime = exceptionEndTime;
    }

    public String getExceptionLastTime() {
        return exceptionLastTime;
    }

    public void setExceptionLastTime(String exceptionLastTime) {
        this.exceptionLastTime = exceptionLastTime;
    }

    public BigDecimal getExceptionPower() {
        return exceptionPower;
    }

    public void setExceptionPower(BigDecimal exceptionPower) {
        this.exceptionPower = exceptionPower;
    }

    public BigDecimal getExceptionElecAmount() {
        return exceptionElecAmount;
    }

    public void setExceptionElecAmount(BigDecimal exceptionElecAmount) {
        this.exceptionElecAmount = exceptionElecAmount;
    }

    public BigDecimal getExceptionServiceAmount() {
        return exceptionServiceAmount;
    }

    public void setExceptionServiceAmount(BigDecimal exceptionServiceAmount) {
        this.exceptionServiceAmount = exceptionServiceAmount;
    }

    //public BigDecimal getSharpPower() {
    //    return sharpPower;
    //}
    //
    //public void setSharpPower(BigDecimal sharpPower) {
    //    this.sharpPower = sharpPower;
    //}
    //
    //public BigDecimal getSharpBaseAmount() {
    //    return sharpBaseAmount;
    //}
    //
    //public void setSharpBaseAmount(BigDecimal sharpBaseAmount) {
    //    this.sharpBaseAmount = sharpBaseAmount;
    //}
    //
    //public BigDecimal getSharpServiceAmount() {
    //    return sharpServiceAmount;
    //}
    //
    //public void setSharpServiceAmount(BigDecimal sharpServiceAmount) {
    //    this.sharpServiceAmount = sharpServiceAmount;
    //}

    public BigDecimal getExceptionTotalMoney() {
        return exceptionTotalMoney;
    }

    public void setExceptionTotalMoney(BigDecimal exceptionTotalMoney) {
        this.exceptionTotalMoney = exceptionTotalMoney;
    }

    public BigDecimal getExceptionDiscountAmount() {
        return exceptionDiscountAmount;
    }

    public void setExceptionDiscountAmount(BigDecimal exceptionDiscountAmount) {
        this.exceptionDiscountAmount = exceptionDiscountAmount;
    }

    public BigDecimal getExceptionPayAmount() {
        return exceptionPayAmount;
    }

    public void setExceptionPayAmount(BigDecimal exceptionPayAmount) {
        this.exceptionPayAmount = exceptionPayAmount;
    }

    public BigDecimal getExceptionBeginSoc() {
        return exceptionBeginSoc;
    }

    public void setExceptionBeginSoc(BigDecimal exceptionBeginSoc) {
        this.exceptionBeginSoc = exceptionBeginSoc;
    }

    public BigDecimal getExceptionSoc() {
        return exceptionSoc;
    }

    public void setExceptionSoc(BigDecimal exceptionSoc) {
        this.exceptionSoc = exceptionSoc;
    }

    public BigDecimal getDiffElecMoney() {
        return diffElecMoney;
    }

    public void setDiffElecMoney(BigDecimal diffElecMoney) {
        this.diffElecMoney = diffElecMoney;
    }

    public BigDecimal getDiffServiceMoney() {
        return diffServiceMoney;
    }

    public void setDiffServiceMoney(BigDecimal diffServiceMoney) {
        this.diffServiceMoney = diffServiceMoney;
    }

    public String getSolution() {
        return solution;
    }

    public void setSolution(String solution) {
        this.solution = solution;
    }

    public String getExceptionStatus() {
        return exceptionStatus;
    }

    public void setExceptionStatus(String exceptionStatus) {
        this.exceptionStatus = exceptionStatus;
    }

    public String getRejectionReason() {
        return rejectionReason;
    }

    public void setRejectionReason(String rejectionReason) {
        this.rejectionReason = rejectionReason;
    }

    public Date getRepairTime() {
        return repairTime;
    }

    public void setRepairTime(Date repairTime) {
        this.repairTime = repairTime;
    }

    public String getLastTime() {
        Date date = new Date();
        if (this.getEndTime() != null && this.getStartTime() != null) {
            long l = this.getEndTime().getTime() - this.getStartTime().getTime();
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
            //八个小时的时差
            date.setTime(l - (1000 * 60 * 60 * 8));
            String format = sdf.format(date);
            return format;
        } else {
            return null;
        }

    }

    public String getPileStopReasonVo() {
        if ("SH_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = ShStopReasonEnum.getStopReasonMsg(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("LNC_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = LncStopReasonEnum.getLncStopReasonEnumByTenant(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("JN_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = JnStopReasonEnum.getMsgJnStopReason(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("YL_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = YlStopReasonEnum.getStopReasonMsg(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("YC_DOMAIN".equals(elecServerDomain) || "ZC_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = ZcElecPileStopReasonEnum.getElecPileStopReasonResultWithInt(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("RS_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = RsStopReasonEnum.getStopReasonResultWithInt(this.getPileStopReason().toString());
            return stopReasonMsg;
        } else if ("YKR_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = YkrPileStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("JUN_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = JunStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return stopReasonMsg;
        }else if ("DC_DOMAIN".equals(elecServerDomain)){
            String stopReasonMsg = DcGunStatusEnum.getDcFaultCode(this.getPileStopReason());
            return stopReasonMsg;
        }else {
            //桩停止原因
            String elecPileStopReasonResult = ElecPileStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return elecPileStopReasonResult;
        }
    }

    public String getExceptionLastUpdatedBy() {
        return exceptionLastUpdatedBy;
    }

    public void setExceptionLastUpdatedBy(String exceptionLastUpdatedBy) {
        this.exceptionLastUpdatedBy = exceptionLastUpdatedBy;
    }

    public String getOrderInfoHlhtType() {
        return orderInfoHlhtType;
    }

    public void setOrderInfoHlhtType(String orderInfoHlhtType) {
        this.orderInfoHlhtType = orderInfoHlhtType;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public String getPileNo() {
        return pileNo;
    }

    public void setPileNo(String pileNo) {
        this.pileNo = pileNo;
    }

    public String getGunNo() {
        return gunNo;
    }

    public void setGunNo(String gunNo) {
        this.gunNo = gunNo;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getTenantName() {
        return tenantName;
    }

    public void setTenantName(String tenantName) {
        this.tenantName = tenantName;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public String getChargeType() {
        return chargeType;
    }

    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }

    public BigDecimal getPower() {
        return power;
    }

    public void setPower(BigDecimal power) {
        this.power = power;
    }

    public BigDecimal getElecAmount() {
        return elecAmount;
    }

    public void setElecAmount(BigDecimal elecAmount) {
        this.elecAmount = elecAmount;
    }

    public BigDecimal getServiceAmount() {
        return serviceAmount;
    }

    public void setServiceAmount(BigDecimal serviceAmount) {
        this.serviceAmount = serviceAmount;
    }

    public void setPileStopReasonVo(String pileStopReasonVo) {
        this.pileStopReasonVo = pileStopReasonVo;
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public String getDiscountType() {
        return discountType;
    }

    public void setDiscountType(String discountType) {
        this.discountType = discountType;
    }

    public String getDiscountName() {
        return discountName;
    }

    public void setDiscountName(String discountName) {
        this.discountName = discountName;
    }

    public BigDecimal getLowPower() {
        return lowPower;
    }

    public void setLowPower(BigDecimal lowPower) {
        this.lowPower = lowPower;
    }

    public BigDecimal getHighPower() {
        return highPower;
    }

    public void setHighPower(BigDecimal highPower) {
        this.highPower = highPower;
    }

    public BigDecimal getFlatPower() {
        return flatPower;
    }

    public void setFlatPower(BigDecimal flatPower) {
        this.flatPower = flatPower;
    }

    public BigDecimal getLowBaseAmount() {
        return lowBaseAmount;
    }

    public void setLowBaseAmount(BigDecimal lowBaseAmount) {
        this.lowBaseAmount = lowBaseAmount;
    }

    public BigDecimal getHighBaseAmount() {
        return highBaseAmount;
    }

    public void setHighBaseAmount(BigDecimal highBaseAmount) {
        this.highBaseAmount = highBaseAmount;
    }

    public BigDecimal getFlatBaseAmount() {
        return flatBaseAmount;
    }

    public void setFlatBaseAmount(BigDecimal flatBaseAmount) {
        this.flatBaseAmount = flatBaseAmount;
    }

    public BigDecimal getLowServiceAmount() {
        return lowServiceAmount;
    }

    public void setLowServiceAmount(BigDecimal lowServiceAmount) {
        this.lowServiceAmount = lowServiceAmount;
    }

    public BigDecimal getHighServiceAmount() {
        return highServiceAmount;
    }

    public void setHighServiceAmount(BigDecimal highServiceAmount) {
        this.highServiceAmount = highServiceAmount;
    }

    public BigDecimal getFlatServiceAmount() {
        return flatServiceAmount;
    }

    public void setFlatServiceAmount(BigDecimal flatServiceAmount) {
        this.flatServiceAmount = flatServiceAmount;
    }

    public String getHlhtOperator() {
        return hlhtOperator;
    }

    public void setHlhtOperator(String hlhtOperator) {
        this.hlhtOperator = hlhtOperator;
    }

    public String getHlhtOperatorName() {
        return hlhtOperatorName;
    }

    public void setHlhtOperatorName(String hlhtOperatorName) {
        this.hlhtOperatorName = hlhtOperatorName;
    }

    public String getElecServerDomain() {
        return elecServerDomain;
    }

    public void setElecServerDomain(String elecServerDomain) {
        this.elecServerDomain = elecServerDomain;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getHlhtTenantName() {
        return hlhtTenantName;
    }

    public void setHlhtTenantName(String hlhtTenantName) {
        this.hlhtTenantName = hlhtTenantName;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getHisStartTime() {
        return hisStartTime;
    }

    public void setHisStartTime(String hisStartTime) {
        this.hisStartTime = hisStartTime;
    }

    public String getHisEndTime() {
        return hisEndTime;
    }

    public void setHisEndTime(String hisEndTime) {
        this.hisEndTime = hisEndTime;
    }

    public String getHisLastTime() {
        return hisLastTime;
    }

    public void setHisLastTime(String hisLastTime) {
        this.hisLastTime = hisLastTime;
    }

    public BigDecimal getHisPower() {
        return hisPower;
    }

    public void setHisPower(BigDecimal hisPower) {
        this.hisPower = hisPower;
    }

    public BigDecimal getHisElecAmount() {
        return hisElecAmount;
    }

    public void setHisElecAmount(BigDecimal hisElecAmount) {
        this.hisElecAmount = hisElecAmount;
    }

    public BigDecimal getHisServiceAmount() {
        return hisServiceAmount;
    }

    public void setHisServiceAmount(BigDecimal hisServiceAmount) {
        this.hisServiceAmount = hisServiceAmount;
    }

    public BigDecimal getHisTotalMoney() {
        return hisTotalMoney;
    }

    public void setHisTotalMoney(BigDecimal hisTotalMoney) {
        this.hisTotalMoney = hisTotalMoney;
    }

    public BigDecimal getHisDiscountAmount() {
        return hisDiscountAmount;
    }

    public void setHisDiscountAmount(BigDecimal hisDiscountAmount) {
        this.hisDiscountAmount = hisDiscountAmount;
    }

    public BigDecimal getHisPayAmount() {
        return hisPayAmount;
    }

    public void setHisPayAmount(BigDecimal hisPayAmount) {
        this.hisPayAmount = hisPayAmount;
    }

    public BigDecimal getHisBeginSoc() {
        return hisBeginSoc;
    }

    public void setHisBeginSoc(BigDecimal hisBeginSoc) {
        this.hisBeginSoc = hisBeginSoc;
    }

    public BigDecimal getHisSoc() {
        return hisSoc;
    }

    public void setHisSoc(BigDecimal hisSoc) {
        this.hisSoc = hisSoc;
    }

    public Date getChargeDate() {
        return chargeDate;
    }

    public void setChargeDate(Date chargeDate) {
        this.chargeDate = chargeDate;
    }

    public String getTimeStr() {
        return timeStr;
    }

    public void setTimeStr(String timeStr) {
        this.timeStr = timeStr;
    }

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }
}
